//
//  CollectionViewPrettyCell.swift
//  DouYuZB
//
//  Created by 刘耀 on 2017/4/12.
//  Copyright © 2017年 深圳多诺信息科技有限公司. All rights reserved.
//

import UIKit

class CollectionViewPrettyCell: UICollectionViewCell {
    
    // MARK: - 控件属性
    @IBOutlet weak var iconImageView: UIImageView!
    
    @IBOutlet weak var titlelabel: UILabel!
    
    @IBOutlet weak var addressLabel: UIButton!
    
    @IBOutlet weak var countLabel: UILabel!
    
    var anchor: AnchorModel? {
        didSet {
            guard let anchor = anchor else {
                return
            }
            iconImageView.kf.setImage(with: URL(string: anchor.vertical_src))
            var onlineStr: String = "" 
            if anchor.online >= 10000 {
                onlineStr = "\(Int(anchor.online / 10000))万在线"
            }else {
                onlineStr = "\(anchor.online)在线"
            }
            countLabel.text = onlineStr
            addressLabel.setTitle(anchor.anchor_city, for: .normal)
            titlelabel.text = anchor.nickname
        }
    }
    
    override func awakeFromNib() {
        super.awakeFromNib()
        // Initialization code
    }

}
